package ljl.codetop;

/**
 * 只能买卖一次
 */
public class _121_max_profit {

    static class tryout {

        // 7 6 5 4
        public int maxProfit(int[] prices) {
            int min = prices[0], max = 0;
            for (int price : prices) {
                min = Math.min(price, min);
                max = Math.max(max, price - min);
            }
            return max;
        }
    }
}
